package beuthTaskList;
import java.util.GregorianCalendar;


public class Task   {

	private int timeSpend ;
	
	private String name ;
	
	private int statusPercent ;
	
	private GregorianCalendar closingDate ;
	
	private TaskType taskType ;
	
	private Priority taskPriority ;
	

	//Start of user code protectedClassAttributesTask
	//End of user code		

	public Task() {
		//Start of user code protectedJavaConstructorTask
		//End of user code
	}

	public Task(int statusPercent, int timeSpend, TaskType taskType, GregorianCalendar closingDate, Priority taskPriority, String name) {
		this.timeSpend = timeSpend;
		this.name = name;
		this.statusPercent = statusPercent;
		this.closingDate = closingDate;
		this.taskType = taskType;
		this.taskPriority = taskPriority;
	}

	public Integer timeLeft() {
		//Start of user code protectedOperationtimeLeft
		Long currentTime = System.currentTimeMillis() / 1000;
		Long closingTime = closingDate.getTimeInMillis() / 1000;
		Long timeLeftInSeconds = closingTime - currentTime;
		//End of user code
		return (int) (long) timeLeftInSeconds / 60 / 60;
	}


	//Start of user code protectedJavaClassCodeTask
	//End of user code

	public int getTimeSpend() {
		// ToDo
		return this.timeSpend;
	}
	
	public void setTimeSpend(int timeSpend) {
			this.timeSpend = timeSpend;
	}
	public String getName() {
		// ToDo
		return this.name;
	}
	
	public void setName(String name) {
			this.name = name;
	}
	public int getStatusPercent() {
		// ToDo
		return this.statusPercent;
	}
	
	public void setStatusPercent(int statusPercent) {
			this.statusPercent = statusPercent;
	}
	public GregorianCalendar getClosingDate() {
		// ToDo
		return this.closingDate;
	}
	
	public void setClosingDate(GregorianCalendar closingDate) {
			this.closingDate = closingDate;
	}
	public TaskType getTaskType() {
		// ToDo
		return this.taskType;
	}
	
	public void setTaskType(TaskType taskType) {
			this.taskType = taskType;
	}
	public Priority getTaskPriority() {
		// ToDo
		return this.taskPriority;
	}
	
	public void setTaskPriority(Priority taskPriority) {
			this.taskPriority = taskPriority;
	}
	

	@Override
	public String toString() {
		String returnString = "";
		
		returnString = returnString + "Die Aufgabe ";
		returnString = returnString + name;
		returnString = returnString + " (" + getTaskType() + ")";
		returnString = returnString + " muss in ";
		returnString = returnString + timeLeft();
		returnString = returnString + " Stunden fertig sein.";
		/*
		returnString = returnString + "Object of type: Task with Attributes: \n"; 
		returnString = returnString + "taskType :<" + taskType + "> ";
		returnString = returnString + "timeSpend :<" + timeSpend + "> ";
		returnString = returnString + "statusPercent :<" + statusPercent + "> ";
		returnString = returnString + "taskPriority :<" + taskPriority + "> ";
		returnString = returnString + "closingDate :<" + closingDate + "> ";
		returnString = returnString + "name :<" + name + "> "; */
	
		//Start of user code protectedToStringTask
		//End of user code
	
		return returnString;
	}
} 
